//    Copyright (C) Kherty.  All rights reserved.
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;


namespace OpenLS.Spreadsheet.UI
{
    partial class DialogResources
    {
        public DialogResources()
        {
            InitializeComponent();
        }
        void OnButtonClick(object sender, RoutedEventArgs args)
        {
            Button button = args.Source as Button;
            if (button == null)
                button = args.OriginalSource as Button;
            Window w = sender as Window;
            if (button == null || w == null)
                return;
            if (button.IsDefault)
            {
                w.DialogResult = true;
                w.Close();
                return;
            }
            if (button.IsCancel)
            {
                w.DialogResult = false;
                w.Close();
                return;
            }
        }
        void OnPopupButtonClick(object sender, RoutedEventArgs args)
        {
            Button button = args.Source as Button;
            if (button == null)
                button = args.OriginalSource as Button;
            Popup w = sender as Popup;
            if (button == null || w == null)
                return;
            if (button.IsDefault)
            {
                w.IsOpen = false;
                return;
            }
            if (button.IsCancel)
            {
                w.IsOpen = false;
                return;
            }
        }
        internal static DialogResources _instance = new DialogResources();
        
    }
}
